Replaces odd scan lines with average of neighboring even lines. Can be used to improve the quality of images that have even and odd fields that are out of sync as the result of subject movement during capture.
}
var
i,width,height,row1,row2:integer;
begin
SaveState;
if NewWindow then Duplicate('Even Field');
GetPicSize(width,height);
row1:=0; row2:=0;
for i:=1 to height/2 do begin
GetRow(0,row1,width);
PutRow(0,row2,width);
row1:=row1+2;
row2:=row2+1;
end;
MakeRoi(0,0,width,height/2);
Copy;
MakeRoi(0,height/4-1,width,height/2);
Paste;
RestoreRoi;
SetScaling('Bilinear; Same Window');
ScaleAndRotate(1,2,0);
RestoreState;
end;
macro 'Extract Even Field->New Window';
begin
ExtractEvenField(true);
end;
macro 'Extract Even Field->Same Window';
begin
ExtractEvenField(false);
end;
macro 'Make Movie to Disk…';
{
Captures images at a specified rate and saves them to disk.
Select an area of interest within the Camera window before
starting. Abort at any time by pressing the mouse button.
}
var
nFrames,n,Left,Top,Width,Height:integer;
interval,EndTicks,secs:integer;
FirstTime:boolean;
begin
GetRoi(Left,Top,Width,Height);
if width=0 then begin
PutMessage('First select the area of interest in the Camera window.');
exit;
end;
nFrames:=GetNumber('Number of Frames?',10);
secs:=GetNumber ('Delay Between Frames (seconds)?',60.0);
interval:=round(secs*60);
FirstTime:=true;
for n:=1 to nFrames do begin
StopCapturing; beep;
MakeRoi(Left,Top,Width,Height);
SaveAs('Frame ',n);
if FirstTime then begin
EndTicks:=TickCount+interval;
FirstTime:=false;
end;
if button then begin
StopCapturing;
exit;
end;
StartCapturing;
while TickCount<EndTicks do begin
secs:=(EndTicks-TickCount) div 60;
ShowMessage(n:1,'/',nFrames,' ',secs:4)
end;
EndTicks:=EndTicks+interval;
end;
StopCapturing;
end;
macro 'Camera and Light Source Test…';
{Use to test cameras and light sources for temporal stability.}
var
delay,nFrames:integer;
i:real;
begin
nFrames:=trunc(GetNumber('Number of Frames:',10));
delay:=trunc(GetNumber('Delay in seconds:',10));
for I:=1 to nFrames do begin
Capture;
Measure;
SetCursor('Watch');
wait(delay);
end;
end;
macro 'Average Frames [F]';
begin
AverageFrames;
end;
macro 'Average Frames on Trigger';
begin
WaitForTrigger;
AverageFrames;
end;
macro 'Dynamic 1-D Plot';
{
Displays a dynamic 1-d plot of a line in the image while the image
is being captured. You most first create a line selection in
Camera window. The macro works best if you first to a Plot Profile
and move the Plot window so it doesn't cover the Camera window. You
may have to resize the Camera window. Hold down the mouse button
to terminate.
}
var
x1,y1,x2,y2,LineWidth:integer;
begin
GetLine(x1,y1,x2,y2,LineWidth);
if x1=-1 then begin
PutMessage('Create a straight line selection in the Camera window');
exit;
end;
SetPlotScale(0,255);
repeat
Capture;
if button then exit;
MakeLineRoi(x1,y1,x2,y2);
PlotProfile;
until button;
end;
macro 'Integrate Inverted…';
{
Inverts captured video to allow more than 128 frames to be
integrated without overflow. For example, the sum of 256 pixels
with an average value of 200(very dark) is 51,200, which is
greater than the 32,767 maximum, but the sum of 256 pixels
with and average value of 55(200 inverted) is 14,080.
}
var
nFrames:integer;
begin
nFrames:=GetNumber('Number of Frames:', 200);
SetVideo('Invert');
AverageFrames('Integrate', nFrames);
SetVideo(''); {Don't invert}
Invert;
end;
macro 'Generate Pulse Train'
{Outputs a 30Hz pulse train on pin 1(Data Output bit 3)}
{of the Scion LG-3's utility connector.}
var
NextTicks,inc:integer;
begin
inc:=1; {1/60 sec.}
SetCursor('watch');
NextTicks:=TickCount+inc;
repeat
scion[4]:=BitOr(scion[4],8);
repeat until TickCount>=NextTicks;
NextTicks:=NextTicks+inc;
scion[4]:=BitAnd(scion[4],7);
repeat until TickCount>=NextTicks;
NextTicks:=NextTicks+inc;
until button;
end;
macro 'Acquire AV Video [V]';
begin
Acquire('Plug-in Digitizer');
end;
macro 'Make AV Time-lapse Movie…';
{
Captures images using the "Plug-in Digitizer" and saves
them to disk. Abort at any time by pressing the mouse button.
}
var
nFrames,n:integer;
interval,StartTicks,EndTicks:integer;
time:real;
path:string;
begin
Requiresversion(1.55);
path:=getString('Folder path:','hd400:movie');
nFrames:=GetNumber('Number of Frames?',10);
time:=GetNumber ('Delay Between Frames (seconds)?',60.0);
interval:=round(time*60);
StartTicks:=TickCount;
EndTicks:=TickCount+interval;
for n:=1 to nFrames do begin
time:=(TickCount-StartTicks)/ 60;
ShowMessage(n:3,' ',time:4:2);
Acquire('Plug-in Digitizer');
MoveTo(2,12);
SetFontSize(12);
SetForegroundColor(255);
write(n:3,' ',time:4:2);
SaveAs(path,':Frame ',n);
Dispose;
while TickCount<EndTicks do begin
if button then exit;
end;
EndTicks:=EndTicks+interval;
end;
end;
macro '(-' begin end; {Menu divider}
macro 'Paste Live [L]';
{
Pastes “live” from Camera window into a rectangular
selection in another window. Use Paste Control to
switch to various semi-transparent transfer modes.
}
begin
PasteLive;
end;
macro 'Paste Averaged [A]';
{
Captures an averaged or integrated selection into a window
other than the Camera window. Use in conjunction with "PasteLive". Useful for making montages of different focal
planes of fluorescent specimens.
}
var
x,y,width,height,pid:integer;
begin
RequiresVersion(1.53);
if WindowTitle='Camera' then begin
PutMessage('The active window cannot be "Camera".');
exit;
end;
GetRoi(x,y,width,height);
if width=0 then begin
PutMessage('Rectangular selection required.');
exit;
end;
pid:=PidNumber;
SelectWindow('Camera');
MakeRoi(x,y,width,height);
AverageFrames;
Copy;
SelectPic(pid);
MakeRoi(x,y,width,height);
Paste;
end;
macro 'Paste Live OR [O]';
begin
PasteLive;
SetOption; DoOr;
end;
macro 'Paste Live XOR [X]';
begin
PasteLive;
SetOption; DoXor;
end;
macro 'Add Duplicate Slice [D]';
{Use with "Paste Live OR" or "Paste Live XOR"}
{to register series of sections into a stack.}
begin
SetOption; DoCopy;
KillRoi;
SelectAll;
Copy;
AddSlice;
Paste;
end;
macro '(-' begin end; {Menu divider}
{Note: keyboard shortcuts do not work when the Video}
{Control dialog box is the active window.}
macro 'SetChannel 1 [1]'; begin SetChannel(1) end;
macro 'SetChannel 2 [2]'; begin SetChannel(2) end;
macro 'SetChannel 3 [3]'; begin SetChannel(3) end;
macro 'SetChannel 4 [4]'; begin SetChannel(4) end;
macro '(-' begin end; {Menu divider}
macro 'Set LG-3 DAC A'; begin scion[1]:=GetNumber('DAC A(0-255):',scion[1]); end;
macro 'Set LG-3 DAC B'; begin scion[2]:=GetNumber('DAC B(0-255):',scion[2]); end;
macro 'Set LG-3 Data Out'; begin scion[4]:=GetNumber('Data Out(0-15):',scion[4]); end;
macro 'Read LG-3 Data In'; begin PutMessage('Data In=',BitAnd(scion[3],15):1); end;